<div id='app'>
    <custom-form @submit="onSubmit"></custom-form>
</div>

<script>
    const app = Vue.createApp({
        data(){
            return {}
        },
        methods:{
            onSubmit(e){
                console.log("onSubmit",e);
            }
        },
        computed:{}
    })

    app.component("custom-form",{
        
        emits:{
            
            click:null,

            
            submit:(e)=>{
                if(e.email && e.password){
                    
                    return true
                }else{
                    console.error("submit事件必须携带邮箱与密码");
                    
                    return false
                }
            }
        },
        methods:{
            sonSubmitForm(e){
                console.log("sonSubmitForm",e);
                this.$emit('submit',e)
            }
        },

        template:`
        <button @click="sonSubmitForm({name:'123654'})">click me</button>
        <button @click="sonSubmitForm({email:'1259701381@qq.com@qq.com',password:'zqr19901013'})">click me</button>
        `
    })

    app.mount('#app')
</script>